package com.zktr.dao;

import java.util.LinkedHashMap;
import java.util.List;

import com.zktr.pojo.GoodsGallery;
import com.zktr.utils.CRUDDAO;

public class GoodsGalleryDao {
	CRUDDAO<GoodsGallery> crud = new CRUDDAO<>(GoodsGallery.class);   
	public static void main(String[] args) {
		GoodsGalleryDao gDao = new GoodsGalleryDao();
		System.out.println(gDao.queryAllGoodsGallery());
	}
	/**
	 * 查询所有数据
	 * @return
	 */
	public List<GoodsGallery> queryAllGoodsGallery(){
    	   String sql="select * from goods_gallery";
    	   LinkedHashMap<String, Object[]> map = new LinkedHashMap<String,Object[]>();
    	   map.put(sql, null);
    	   return crud.selectAll(map).get(0);
    	   
       }
	/**
	 * 查询首页轮播图片
	 * slideshow:幻灯片,轮播图
	 * @return 
	 */
	public List<GoodsGallery> selectIndexSlideshow() {
		return crud.select("select * from goods_gallery where imgdesc='1'");
	}
	/**
	 *查询导航栏左侧广告图片
	 * @return 
	 */
	public List<GoodsGallery> selectAdimg() {
		return crud.select("select * from goods_gallery where imgdesc='0' order by imgid");
	}
	/**
	 * 查询轮播图右侧广告图片
	 * @return 
	 */
	public List<GoodsGallery> selectAdimgRight() {
		return crud.select("select * from goods_gallery where imgdesc='00' order by imgid");
	}
}
